#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/shm.h>
#include <sys/un.h>


#include "ipc.h"
#include "request.h"
#include "media_request.h"


//#define MEDIA_REQUEST_DEBUG		1

#ifdef	 MEDIA_REQUEST_DEBUG
#define MEDIA_REQ_DEBUG(fmt, args...)	fprintf(stderr, fmt, ##args)
#else
#define MEDIA_REQ_DEBUG(fmt, args...)
#endif
#define MEDIA_REQ_ERR(fmt, args...)	fprintf(stderr, fmt, ##args)



const struct media_request_lock_frame MEDIA_REQ_LOCK_FRAME_DEFAULT =
{
	{
	PROTOCOL_VERSION,	
	MEDIA_MODULE_TYPE|LOCK_FRAME,
	ACTION_REQUEST_TYPE,
	REQUEST_HEAD_BYTES,
	REQUEST_RESULT_OK,
	}
};

const struct media_request_lock_frame_serial MEDIA_REQ_LOCK_FRAME_SERIAL_DEFAULT =
{	
	{
	PROTOCOL_VERSION,	
	MEDIA_MODULE_TYPE|LOCK_FRAME_SERIAL,
	ACTION_REQUEST_TYPE,
	REQUEST_HEAD_BYTES+4,
	REQUEST_RESULT_OK,
	},
	0,
};

const struct media_request_unlock_frame_serial MEDIA_REQ_UNLOCK_FRAME_SERIAL_DEFAULT =
{
	{
	PROTOCOL_VERSION,	
	MEDIA_MODULE_TYPE|UNLOCK_FRAME_SERIAL,
	ACTION_REQUEST_TYPE,
	REQUEST_HEAD_BYTES+4,
	REQUEST_RESULT_OK,
	},
	0,
};


/*
int media_request_skt(IPC_SOCKET_HANDLE  hipc_skt,struct request_head* preq_head,char* buf,int rcv_len)
{
	struct ipc_socket_packet  sktp_packet;
	
	if((preq_head == NULL)||(buf == NULL))
	return -1;
	
	sktp_packet.sbuf			=	(char*)preq_head;
	sktp_packet.snd_len			=	preq_head->RequestBytes;
	sktp_packet.rbuf			=	buf;
	sktp_packet.need_rcv_len	=	rcv_len;

	return client_ipc_socket_packet(hipc_skt,&sktp_packet,IPC_TYPE_BIDIRECTIONAL);
}
*/






